package cn.com.flever.app.handler;

import cn.com.flever.app.utils.EncryptionUtils;
import com.alibaba.fastjson.JSONObject;
import org.java_websocket.client.WebSocketClient;



public abstract class AbstractHandler {

    public abstract JSONObject run(JSONObject req, WebSocketClient client);

    public abstract JSONObject dispacher(JSONObject req, WebSocketClient client);

    /**
     * 发送消息方法
     * @param res
     * @param client
     */
    public static void send(JSONObject res,WebSocketClient client)
    {
        //连接成功,发送客户端启动信息
        client.send(EncryptionUtils.encrypt(res.toJSONString()));
    }
}
